package csdn;

import java.io.File;
import java.io.IOException;

public class Test1 {
    public static void main(String[] args) {
        String pathname="D:\\javacode\\javacode\\IO_1\\test_1.txt";//文件路径
        File file = new File(pathname);
        try {
            if(file.createNewFile())//创建文件
            {
                System.out.println("文件创建成功");
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        System.out.println(file.exists());
        System.out.println(file.getName());
        System.out.println(file.getAbsolutePath());
        System.out.println(file.length());
        System.out.println(file.isFile());
        System.out.println(file.isDirectory());
    }
}
